﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OrderAggregator.DataStorage
{
    /// <summary>
    /// Storage extender
    /// </summary>
    public static class StorageExtender
    {
        /// <summary>
        /// Get organization order
        /// </summary>
        /// <param name="organizationRow"></param>
        /// <returns></returns>
        public static int GetOrganizationOrder(this Storage.OrganizationRow organizationRow)
        {
            int order = -1;
            while (organizationRow != null)
            {
                order++;
                organizationRow = organizationRow.OrganizationRowParent;
            }

            return order;
        }
    }
}
